home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / jpl_c.zip / FWRITE.C < prev    next >
Text File  |  1986-05-18  |  896b  |  33 lines

  1. /* 1.0  12-14-84                         (fwrite.c)
  2.  ************************************************************************
  3.  *            Robert C. Tausworthe                *
  4.  *            Jet Propulsion Laboratory            *
  5.  *            Pasadena, CA 91009        1984        *
  6.  ************************************************************************/
  7.  
  8. #include "defs.h"
  9. #include "stdtyp.h"
  10. #include "stdio.h"
  11.  
  12. /************************************************************************/
  13.  
  14. fwrite(ptr, ptrsiz, nitems, fp)    /* Append at most nitems of data of type
  15.                    *ptr to FILE fp.  Return number of
  16.                    items actually written.        */
  17. /*----------------------------------------------------------------------*/
  18. FAST BUFFER ptr;
  19. FILE *fp;
  20. {
  21.     int items;
  22.     FAST int c, i;
  23.     METACHAR putc();
  24.  
  25.     for (items = 0; items < nitems; ++items)
  26.     {    for (i = ptrsiz; i; --i)
  27.         {    if (putc(*ptr++, fp) IS EOF)
  28.                 return items;
  29.         }
  30.     }
  31.     return items;
  32. }
  33.